package cn.circle.system.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.NotEmpty;

/**
 * 用户角色类 
 * 对应数据库表：SYS_ROLES
 */
@Entity
@Table(name="SYS_ROLES")
@DynamicInsert(true)
@DynamicUpdate(true)
public class SysRoles implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private Integer id;   //编号
	private String roleName;  //角色名称
	private String remark;  //说明
	private Byte status;   //状态
	private SysDepartment sysDepartment;
	private Long createUserId;   //创建者
	private java.sql.Timestamp createTime;  //创建时间
	private String roleMenus;	//所具有的菜单编号
	
	
	@Id
	@Column(name = "ID",unique = true,nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)		//自增长
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@NotEmpty(message="角色名称不能为空！")
	@Column(name = "ROLE_NAME")
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	@NotNull
	@Column(name = "STATUS",columnDefinition ="tinyint not null default 9")
	public Byte getStatus() {
		return status;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}
//	@Column(name = "DEP_ID")
//	public Long getDepId() {
//		return depId;
//	}
//	public void setDepId(Long depId) {
//		this.depId = depId;
//	}
	@ManyToOne(targetEntity = SysDepartment.class)
	@JoinColumn(name = "DEP_ID")
	public SysDepartment getSysDepartment() {
		return sysDepartment;
	}
	public void setSysDepartment(SysDepartment sysDepartment) {
		this.sysDepartment = sysDepartment;
	}
	@Column(name = "CREATE_USER_ID")
	public Long getCreateUserId() {
		return createUserId;
	}
	
	public void setCreateUserId(Long createUserId) {
		this.createUserId = createUserId;
	}
	@Column(name = "CREATE_TIME" ,columnDefinition ="timestamp default CURRENT_TIMESTAMP")
	public java.sql.Timestamp getCreateTime() {
		return createTime;
	}
	public void setCreateTime(java.sql.Timestamp createTime) {
		this.createTime = createTime;
	}
	
	
	
	@Column(name="ROLE_MENUS",columnDefinition="TEXT")
	public String getRoleMenus() {
		return roleMenus;
	}
	public void setRoleMenus(String roleMenus) {
		this.roleMenus = roleMenus;
	}
	
	

}
